﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LinqExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            var words = new string[] { "A", "AB", "ABCD", "ABC" };
            var maxLength = words.Max(s => s.Length);
            var longestWord = words.Where(s => s.Length == maxLength).FirstOrDefault();
            if (longestWord != null)
            {
                Console.WriteLine(longestWord);
            }

            var orderdByLength = words.OrderBy(s => s.Length);

            var wordLengths = words.Select(s => s.Length);

            var things = words.Select(s => new Thing() { Name = s });

            var n = 101;
            var xs = Enumerable.Range(0, n).Select(x => x * Math.PI / (n - 1));
            var ys = xs.Select(x => Math.Sin(x));
            var posYs = ys.Where(y => y >= 0);
        }
    }
}
